package cn.com.acca.ma.dao.impl;

import cn.com.acca.ma.dao.RelStockInfoConceptBoardDao;
import cn.com.acca.ma.hibernate.util.HibernateUtil;
import cn.com.acca.ma.model.ConceptBoard;
import cn.com.acca.ma.model.RelStockInfoConceptBoard;

import java.util.List;

public class RelStockInfoConceptBoardDaoImpl extends BaseDaoImpl<RelStockInfoConceptBoardDaoImpl> implements
        RelStockInfoConceptBoardDao {

    public RelStockInfoConceptBoardDaoImpl() {
    }

    /**
     * truncate表rel_stock_info_concept_board
     */
    @Override
    public void truncateTable() {
        session= HibernateUtil.currentSession();
        session.beginTransaction();
        session.createSQLQuery("truncate table rel_stock_info_concept_board").executeUpdate();
        session.getTransaction().commit();
        session.close();
    }

    /**
     * 批量插入RelStockInfoConceptBoard对象列表
     * @param relStockInfoConceptBoardList
     */
    @Override
    public void batchSave(List<RelStockInfoConceptBoard> relStockInfoConceptBoardList) {
        session= HibernateUtil.currentSession();
        session.beginTransaction();
        for (RelStockInfoConceptBoard relStockInfoConceptBoard: relStockInfoConceptBoardList){
            session.save(relStockInfoConceptBoard);
        }
        session.getTransaction().commit();
        session.close();
    }
}
